home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / nrpas13.arc / PLGNDR.DEM < prev    next >
Text File  |  1991-05-01  |  793b  |  32 lines

  1. PROGRAM d6r27(input,output,dfile);
  2. (* driver for routine PLGNDR *)
  3. VAR
  4.    fac,val,x : real;
  5.    i,j,m,n,nval : integer;
  6.    txt : string[20];
  7.    dfile : text;
  8.  
  9. (*$I MODFILE.PAS *)
  10. (*$I PLGNDR.PAS *)
  11.  
  12. BEGIN
  13.    glopen(dfile,'fncval.dat');
  14.    REPEAT readln(dfile,txt) UNTIL (txt = 'Legendre Polynomials');
  15.    readln(dfile,nval);
  16.    writeln(txt);
  17.    writeln('n':4,'m':4,'x':10,'actual':19,'plgndr(n,m,x)':20);
  18.    FOR i := 1 to nval DO BEGIN
  19.       readln(dfile,n,m,x,val);
  20.       fac := 1.0;
  21.       IF (m > 0) THEN BEGIN
  22.          FOR j := n-m+1 to n+m DO BEGIN
  23.             fac := fac*j
  24.          END
  25.       END;
  26.       fac := 2.0*fac/(2.0*n+1.0);
  27.       val := val*sqrt(fac);
  28.       writeln(n:4,m:4,'   ',x:13,'   ',val:13,'   ',plgndr(n,m,x):13)
  29.    END;
  30.    close(dfile)
  31. END.
  32.